package Behavioral.ChainOfResponsibility.demo1;


import com.google.common.collect.Lists;

import java.util.List;

public class FilterChain implements Filter{
	List<Filter> filters = Lists.newArrayList();

	public FilterChain add(Filter filter) {
		filters.add(filter);
		return this;
	}

	public boolean doFilter(CyMsg msg) {
		for (Filter filter : filters) {
			if (filter.doFilter(msg) == false) {
				return false;
			}
		}
		return true;
	}
}
